package leetcode.p1877;

import java.util.Arrays;
import java.util.Map;

/**
 * @author: trtan
 * @date: 2021-07-20 09:09
 **/
public class MinimizeMaximumPairSum {

    /**
     * 排序 贪心
     * @param nums
     * @return int
     * @author trtan
     * @date 2021/7/20 9:12
     */
    public int minPairSum(int[] nums) {
        Arrays.sort(nums);
        int max = 0;
        for (int i = 0; i < nums.length / 2; i++) {
            max = Math.max(max, nums[i] + nums[nums.length - i - 1]);
        }
        return max;
    }
}
